/**
 * 
 */
package acmCoder;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

/**
 * @author zhongfang
 *
 */
public class 生日礼物 {

	static class Card implements Comparable<Card>{
		int h;
		int w;
		int index;
		public Card(int h,int w,int index) {
			this.h=h;
			this.w=w;
			this.index=index;
		}
		@Override
		public int compareTo(Card o) {//如果长度和宽度都是一致大小，则比较长宽，否则需要比较输入的先后
			if(this.h<o.h&&this.w<o.w){
				return -1;
			}
			if(this.h>o.h&&this.w>o.w){
				return 1;
			}
			return o.index-this.index;
		}
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		while (scanner.hasNext()) {
			int n=scanner.nextInt();
			int w=scanner.nextInt();
			int h=scanner.nextInt();
			PriorityQueue<Card> cards=new PriorityQueue<>(n);
			for (int i = 0; i < n; i++) {
				Card card=new Card(scanner.nextInt(), scanner.nextInt(),i);
				cards.add(card);
			}
			Card minAvalableCard=null;
			int i = 0;//找到第一个能装下的信封
			while (!cards.isEmpty()) {
				Card card=cards.poll();
				if(card.h>h&&card.w>w){
					minAvalableCard=card;
					break;
				}
				i++;
			}
			if(cards.isEmpty()){
				System.out.println(0);
				continue;
			}
			ArrayList<Integer> avaIndex=new ArrayList<>();
			avaIndex.add(minAvalableCard.index);
			int count=1;
			while(!cards.isEmpty()){
				Card curCard=cards.poll();
				if(curCard.h>minAvalableCard.h&&curCard.w>minAvalableCard.w){//能装下上一个信封
					count++;
					minAvalableCard=curCard;
					avaIndex.add(curCard.index);
				}
				i++;
			}
			System.out.println(count);
			for (Integer integer : avaIndex) {
				System.out.print((integer+1)+" ");
			}
			System.out.println();
		}		
	}

}
